Mastodon

Crazy's Amazing Corner on the Web

/blog/2025/Making of my Mailserver/

06. February 2025 at 22:00

Making of my Mail server!

Hello reader! As a head start before you start reading, I am a Not Native speaker of the English Language and therefor may make Spelling and Grammatical Errors, please keep that in mind. You can correct them if you feel like it on my GitLab Repo where this website resides on!

Why?

The first question obviously is why would I go to the effort of Setting up and managing my on Mail server? Well my reason are quite simple, I wanted to have control over my email. As service Providers can read your email, unless you PGP encryption with all your contacts. But furthermore I wanted control over the flow and security of my Email. As I want to see if someone logs on or even attempts it, and I want to experiment with Features email Server can provide like Plus addressing and Catch All.

The Software

The Software I use for my Mail server was Docker-Mailserver. A project that makes a Docker Image for a Mail server (duh), it builds upon the standard Linux tooling like Dovecot, Postfix, etc… and Containerizes it and ships it with their own management CLI tool. Which is also only a simplification to the standard tooling they incorporate. It is lightweight and easy to Deploy and Redeploy in case of moving it.

The Host

It wasn't Possible to host the Mail server in my Home lab, as it doesn't fit into my Safety scheme for it. Furthermore, I don't have Static IP address and Non-Commercial IP Addresses usually get flagged by the Bigger Mail providers anyway. So that rules out the Home lab completely.

So I took a look to Cloud Providers and chose my favorite one, Hetzner. They are German Based, this is where I am from, and I have good experiences with them.

So I choose them and rented a Shared CPU Machine with the Docker VM Image provided by Hetzner.

The Setup

The Setup was actually quite Straightforward, I copied they're docker-compose.yml and mailserver.yml and adjusted them. The other Adjustments I did was adding Roundcube to it and hooking it in to my caddy to so it uses its auto generated Certificates, which they luckily provide a how to in their docs for. The finally steps was adding it to my Monitoring, which I might Post in the Future about :), and adjusting the DNS.

Conclusion

I have had the Mail server running for the past few Days with no Issue. But I do notice the amount of people trying to log in into my Mail Server which luckily with the Power of Fail2Ban get blocked and Banned.

It was a Fun Project and would recommend it as a good Project to get to learn a bit more about mail and in particular about the Security Methods like DKIM.